<template>
  <u-form-grid :data="formGrid"></u-form-grid>
</template>

<script>
export default {
  name: 'Area',
  data () {
    return {
      formGrid: {
        options: {
          version: 'v2',
          url: {
            page: "/areas/page",
            save: "/areas/save",//记录添加和修改提交的地址，如果提交的对象有id则为修改
            delete: "/areas/delete",//记录删除的提交地址，通过提交id的集合来实现一个或者多个记录
            get: "/areas/find",//查看和编辑时用于查询对象的接口，参数为定义的keys
          }
        },
        tips: {title: "区域管理", content: "FormGrid是一个结合表单查询、修改、删除等全功能的组件。方便快速实现CRUD功能!"},
        toolbar:{
//          create: { label: "添加省" },
          delete: { show :false }
        },
        form: {
          modal: {
            title: "区域信息"
          },
          columns: [
            {label: "父级", type: "cascader", name: "parentIds", changeOnSelect:true, required: false, data: "url:areas/find", view: { show: false }, edit: { show: false },},
            {label: "父级", type: "text", name: "fullPathName", required: false, add: {show: false}, edit: { disabled: true },},
            {label: "地区名称", type: "text", name: "name", required: true},
            {label: "地区代码", type: "text", name: "code", required: true},
            {label: "排序", type: "text", name: "rank", required: false},
          ]
        },
        table: {
          operation: {
            //调用查看、编辑、删除接口时，需要传递的参数主键名称，可以有多个。默认为id
            primaryKey: "id",
          },
          columns: [
            { title: '父级', key: 'fullPathName' },
            { title: '地区名称', key: 'name' },
            { title: '地区代码', key: 'code' },
            { title: '排序', key: 'rank' },
          ]
        }
      }
    }
  },
  methods: {

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
